//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#pragma once

#include "Base/Include/Common.h"

namespace Engine
{
namespace Base
{
	
	//
	// Video Settings
	//

	struct VideoSettings
	{
		enum EColorFormat
		{
			R8_G8_B8_A8		= 0x08080808,
			R4_G4_B4_A4		= 0x04040404,
			R5_G6_B5		= 0x05060500,

			RGBA8			= R8_G8_B8_A8,
			RGBA4			= R4_G4_B4_A4,
			RGB565			= R5_G6_B5,
		};

		enum EDepthFromat
		{
			NO_DEPTH		= 0,
			DEPTH_16		= 16,
			DEPTH_24		= 24,
			DEPTH_32		= 32,
		};

		enum EStencilFormat
		{
			NO_STENCIL		= 0,
			STENCIL_8		= 8,
		};

		enum EVersion
		{
			OPENGLES_1_0	= 0x10,
			OPENGLES_1_1	= 0x11,
			OPENGLES_2_0	= 0x20,
			OPENGLES_3_0	= 0x30,
			DEFAULT			= OPENGLES_2_0
		};

		EColorFormat	colorFormat;	// R, G, B, A size in bits
		uint8			depthBits;
		uint8			stencilBits;
		uint8			multiSamples;
		uint8			version;
		///
		VideoSettings (	EColorFormat colorFmt = RGBA8,
						uint8		 depth    = DEPTH_16,
						uint8		 stencil  = NO_STENCIL,
						uint8		 samples  = 0,
						uint8		 ver	  = DEFAULT ) :
			colorFormat(colorFmt), depthBits(depth),
			stencilBits(stencil), multiSamples(samples),
			version(ver)
		{}

		uint8 RedBits ()		const	{ return (colorFormat >> 24) & 0xFF; }
		uint8 GreenBits ()		const	{ return (colorFormat >> 16) & 0xFF; }
		uint8 BlueBits ()		const	{ return (colorFormat >>  8) & 0xFF; }
		uint8 AlphaBits ()		const	{ return (colorFormat & 0xFF); }

		uint8 MajorVersion ()	const	{ return (version & 0xF0) >> 4; }
		uint8 MinorVersion ()	const	{ return (version & 0xF); }
	};

}	// Base
}	// Engine